package com.yanqu.road.logic.activity.foxcard.game.buff;

import com.yanqu.road.entity.activity.foxcard.FoxBaseCard;
import com.yanqu.road.entity.activity.foxcard.FoxHandCard;
import com.yanqu.road.logic.activity.foxcard.game.FoxCardGameLogic;
import com.yanqu.road.logic.activity.foxcard.game.eFoxCardTriggerType;

import java.util.Collections;
import java.util.List;

/**
 * 打出后概率摧毁
 * 筹码|乘筹码|倍率|乘倍率|金币|概率
 */
public class FoxCardBuff5 extends FoxCardBuffBase {
    @Override
    protected boolean buffHandle(FoxCardGameLogic gameLogic) {
        if (triggerType == eFoxCardTriggerType.AFTER_SCORE) {
            int randomValue = gameLogic.getConfig().getRandomHelper().next(1000);
            int checkValue = buffConfig.getParamsList().get(5);
            if (checkValue > randomValue) {
                if (baseCard instanceof FoxHandCard) {//手牌才有摧毁效果,定死了
                    gameLogic.destroyHandCards(Collections.singletonList((FoxHandCard) baseCard));
                }
                return true;
            }
        }

        if (triggerType == eFoxCardTriggerType.SCORE) {
            List<FoxBaseCard> settleCards = Collections.singletonList(baseCard);

            int addBaseScore = buffConfig.getParamsList().get(0);
            int addBaseScoreMulti = buffConfig.getParamsList().get(1);
            int addBaseMulti = buffConfig.getParamsList().get(2);
            int addBaseMultiMulti = buffConfig.getParamsList().get(3);
            int goldChange = buffConfig.getParamsList().get(4);

            gameLogic.addBaseScore(addBaseScore, settleCards, null); //加基础筹码
            gameLogic.addBaseScoreMulti(addBaseScoreMulti, settleCards, null); //当前基础筹码乘算
            gameLogic.addBaseMulti(addBaseMulti, settleCards, null); //加基础倍率
            gameLogic.addBaseMultiMulti(addBaseMultiMulti, settleCards, null); //当前基础倍率乘算
            gameLogic.goldChange(goldChange, settleCards, null, triggerType); //加金币
        }

        return false;
    }
}
